package com.itheima.Test;

import com.sun.org.apache.bcel.internal.generic.NEW;
import org.apache.ibatis.logging.stdout.StdOutImpl;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @PackageName: com.itheima.Test
 * @ClassName: ThreadPoolTest
 * @Author: Renyz
 * @Date: 2021/11/14 20:10
 * @Description: //TODO
 */


public class ThreadPoolTest {

    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);
        try {
            for (int i = 0; i < 10; i++) {
                executorService.submit(() ->{
                    System.out.println(Thread.currentThread().getName());
                });
            }

        }catch (Exception e){

        }finally {
            executorService.shutdown();
        }


    }
}